﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Hosting;
using System.IO;

namespace MedicViet
{
    public class DiskFileStore : IFileStore
    {
        private string _uploadsFolder = HostingEnvironment.MapPath("~/Content/Upload/Thumb");

        public Guid SaveUploadedFile(HttpPostedFileBase fileBase)
        {
            var identifier = Guid.NewGuid();
            string gDL = GetDiskLocation(identifier);
            fileBase.SaveAs(gDL);
            return identifier;
        }

        public string GetDiskLocation(Guid? identifier)
        {
            return Path.Combine(_uploadsFolder, identifier.ToString() + ".png");
        }
    }
}